package com.dong.HashMap.arithemtic;

import java.util.Arrays;
/*
    1.将字符串转换为字符数组：toCharArray
    2.Arrays.equals比较两个数组是否相等
    3.Arrays.toString输出各中类型的数组
    4.Arrays.sort对 各类型的数组进行排序
 */
public class Demo1_method2 {
    public static void main(String[] args) {
        String s = "anagram";
        String t = "nagaram";
        boolean anagram = isAnagram(s, t);
        System.out.println(anagram);
    }
    public static boolean isAnagram(String s, String t) {
        char[] chars1 = s.toCharArray();
        char[] chars2 = t.toCharArray();
        Arrays.sort(chars1);
        Arrays.sort(chars2);
        System.out.println(chars1);
        return Arrays.equals(chars1,chars2);

    }
}
